const testConfig = {
  name: 'car-nuxt-test',
  script: 'node_modules/.bin/nuxt',
  args: 'start --dotenv ./.test.env',
  max_memory_restart: '1G',
  log_date_format: 'YYYY-MM-DD HH:mm:ss.SSS',
  timestamp: true,
  error_file: 'logs/error.log',
  out_file: 'logs/out.log'
};

const preConfig = {
  name: 'car-nuxt-pre',
  script: 'node_modules/.bin/nuxt',
  args: 'start --dotenv ./.pre.env',
  max_memory_restart: '1G',
  log_date_format: 'YYYY-MM-DD HH:mm:ss.SSS',
  timestamp: true,
  error_file: 'logs/error.log',
  out_file: 'logs/out.log'
};

const prodConfig = {
  name: 'car-nuxt-prod',
  script: 'node_modules/.bin/nuxt', // 直接使用nuxt命令
  args: 'start --dotenv ./.prod.env',
  exec_mode: 'cluster',
  instances: 2,
  max_memory_restart: '1G',
  log_date_format: 'YYYY-MM-DD HH:mm:ss.SSS',
  timestamp: true,
  error_file: 'logs/error.log',
  out_file: 'logs/out.log'
};

module.exports = {
  apps: [testConfig, preConfig, prodConfig]
};
